package com.example.freemarkerDemo.domain.vo;

import com.example.freemarkerDemo.domain.User;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @version 1.0
 * @author: 枫玥筱筱
 * @date: 2024/3/29 9:07
 * 描述：
 */
@Data
@AutoMapper(target = User.class)
public class UserVo implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;
    private Long id;
    private String name;
    private Integer age;
    private String email;
    private Long managerId;
    private LocalDateTime createTime;
    private String dataTime;
    private LocalDateTime updateTime;
    private Integer version;
    private Integer deleted;

      /* public void setDataTime() {
        //指定日期格式
        DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        this.dataTime = format.format(this.createTime);
    }*/

    public String getDataTime() {
        //指定日期格式
        DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        if (this.createTime!=null) {
            this.dataTime = format.format(this.createTime);
        }
        return dataTime;
    }
}
